using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class AudioManager : MonoBehaviour
{
    public static AudioManager Instance { get; private set; }

    public AudioClip birdCollison;
    public AudioClip birdSelect;
    public AudioClip birdFlying;
    public AudioClip[] pigCollisons;
    public AudioClip woodCollison;
    public AudioClip woodDestoryed;

    private void Awake()
    {
        Instance = this;
    }

    public void PlayBirdCollison(Vector3 position)
    {
        AudioSource.PlayClipAtPoint(birdCollison, position, 1f);
    }

    public void PlaySelectCollison(Vector3 position)
    {
        AudioSource.PlayClipAtPoint(birdSelect, position, 1f);
    }

    public void PlayFlyingCollison(Vector3 position)
    {
        AudioSource.PlayClipAtPoint(birdFlying, position, 1f);
    }

    public void PlaPigCollison(Vector3 position)
    {
        int index = Random.Range(0, pigCollisons.Length);
        AudioSource.PlayClipAtPoint(pigCollisons[index], position, 1f);
    }

    public void PlayWoodCollison(Vector3 position)
    {
        AudioSource.PlayClipAtPoint(woodCollison, position, 0.6f);
    }

    public void PlayWoodDestoryed(Vector3 position)
    {
        AudioSource.PlayClipAtPoint(woodDestoryed, position, 1f);
    }
}
